class CreateSpaceTypes < ActiveRecord::Migration
  def self.up
    create_table :space_types do |t|
      t.string :name
      t.string :code
    end
    SpaceType.create :name => 'sina', :code => 'vid'
    SpaceType.create :name => 'bilibili', :code => 'avid'
    SpaceType.create :name => 'other', :code => 'id'
    SpaceType.create :name => 'youku', :code => 'ykid'
    SpaceType.create :name => 'qq', :code => 'qid'
    SpaceType.create :name => 'tudou', :code => 'uid'
    add_column :flash_vars, :space_type_id, :integer
  end

  def self.down
    remove_column :flash_vars, :space_type_id
    drop_table :space_types
  end
end
